package com.example.demo.day3.adapter;

import com.example.demo.R;
import com.example.demo.day3.bean.NewsBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;


public class NewsAdapter extends BaseQuickAdapter<NewsBean, BaseViewHolder> {
    public NewsAdapter() {
        super(R.layout.item_news);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, NewsBean newsBean) {
        baseViewHolder.setText(R.id.tv_index, String.valueOf(baseViewHolder.getAdapterPosition()));
        baseViewHolder.setText(R.id.tv_news_title, newsBean.getTitle());
        baseViewHolder.setText(R.id.tv_hot, newsBean.getHot() + " 万热度");
        baseViewHolder.setImageResource(R.id.img_cover, newsBean.getDrawable());

    }
}
